package com.reyco1.platformengine.character
{
	import com.reyco1.platformengine.core.CoordinateUtil;
	
	public class Enemy extends BaseCharacter
	{
		public var hero:BaseCharacter;
		public var isDead:Boolean = false;
		public var direction:Number = 1;
		
		public function Enemy(w:Number, h:Number)
		{
			super(w, h);
		}
		
		override public function build():void
		{
			defColor = 0x0000FF;
			super.build();
		}
		
		override public function move(xFactor:Number, yFactor:Number, jumpFactor:Number = 0):void
		{
			super.move(xFactor, yFactor, jumpFactor);
			calculateDistanceFromHero();
		}
		
		private function calculateDistanceFromHero():void
		{
			var xDist:Number = x - hero.x;
			var yDist:Number = y - hero.y;
			if(Math.sqrt(xDist * xDist + yDist * yDist) < (width * 0.5) + (hero.width * 0.5))
			{
				trace("hit!!");
			}
		}
		
	}
}